<?php
/*=============================================================================
|| ##################################################################
||	phpFoX Konsort
|| ##################################################################
||	
||	Copyright		: (C) 2005-2007 PHPFOX Limited a Reality Fox Creation
||	Contact			: info@phpfox.com
||
||	- phpFoX and all of its source code and files are protected by Copyright Laws. 
||
||	- The license for phpFoX permits you to install this software on a single domain (.com, .org, .net, etc.). 
||
||	- You may also not remove this copyright screen which shows the copyright information and credits for phpFoX (RealityFOX Creations). 
||
||	- phpFoX Konsort is NOT a FREE software - http://www.phpfox.com/license/
||
|| ##################################################################
=============================================================================*/

/* $File: ./include/modules/Account/classes/PhpFox_ComponentFriendsPending.class.php, $Author:  $ */



/** Display pending friends requests
 * 
 * Parameters:
 *  1. oUser (mandatory) - user account object
 * 
 * @package module.account
 * @version $Id: PhpFox_ComponentFriendsPending.class.php 46 2007-12-14 23:12:21Z phpfoxsv $
 *   
 */
class PhpFox_Mod_Account_ComponentFriendsPending extends BaseComponent
{

    /** Processing method
     */
	function process()
	{
	    $oAcc = $this->getParam('oUser');
	    assert(null != $oAcc);
	    
		$oReq = &App::getRequest();
	    $oSrvFriends = $this->_oModule->getService('Friends');
		/* @var $oSrvFriends PhpFox_Mod_Account_ServiceFriends */
		
		$iPage = $oReq->getInt('page', 1);
		$iPageSize = App::getParam('public.pagesize');
		
		list($aFriends, $iTotal) = $oSrvFriends->getPendingList($oAcc, $iPage, $iPageSize);
		$oPager = App::newObject('Pager', $iTotal, $iPage, $iPageSize);
		/* @var $oPager Pager */

		$oTpl = &$this->_oModule->getTemplate();
		$oTpl->assign(array(
			'iNumFriends' => $oSrvFriends->getFriendsCount($oAcc),
			'iRowSize'    => $this->getParam('iRowSize', 3),
			'aFriends'    => $aFriends,
			'sUserPicUrl' => App::getParam('user.pic.url'),
			'iTotal'      => $iTotal,
            'aPaging'     => $oPager->getInfo(App::getUrl()),
		));
		
		$srcHtml = $oTpl->fetch('FriendsPending.html');
		return $srcHtml;
	}

}
?>